<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8"/>
    <title>组件的状态</title>
</head>
<body>
<div id="app"></div>

<!--script-->
<script src="lib/react/react.js"></script>
<script src="lib/react/JSXTransformer.js"></script>
<script type="text/jsx">
    var ClickApp = React.createClass({
        getInitialState: function () {
            return {
                clickCount: 0
            }
        },
        handleClick: function () {
            this.setState({
                clickCount: this.state.clickCount + 1
            })
        },
        render: function () {
            return (
                <div>
                    <h2>点击下面按钮</h2>
                    <button onClick={this.handleClick}>点击我</button>
                    <p>你一共点击了:{this.state.clickCount}次</p>
                </div>
            )
        }
    });

    var clcikApp =  React.render(<ClickApp/>,
        document.getElementById("app"),
        function () {
            console.log("渲染完成了")
        });
</script>
</body>
</html>
